#!/usr/bin/python
import cv2

# 打开画面
cap = cv2.VideoCapture(0)

while(True):
    # 读取一帧
    ret, frame = cap.read()

    # 显示画面
    cv2.imshow('frame', frame)

    # 按下q键退出
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# 释放资源
cap.release()
cv2.destroyAllWindows()